/**
 * <copyright>
 * </copyright>
 *

 */
package hu.bme.mit.androtext.gui.androGuiLang.impl;

import hu.bme.mit.androtext.gui.androGuiLang.AndroGuiLangPackage;
import hu.bme.mit.androtext.gui.androGuiLang.ListPreference;
import hu.bme.mit.androtext.gui.androGuiLang.PreferenceDefaultValueAttribute;
import hu.bme.mit.androtext.gui.androGuiLang.PreferenceDialogTitleAttribute;
import hu.bme.mit.androtext.gui.androGuiLang.PreferenceEntriesAttribute;
import hu.bme.mit.androtext.gui.androGuiLang.PreferenceEntryValuesAttribute;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>List Preference</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link hu.bme.mit.androtext.gui.androGuiLang.impl.ListPreferenceImpl#getDialogTitle <em>Dialog Title</em>}</li>
 *   <li>{@link hu.bme.mit.androtext.gui.androGuiLang.impl.ListPreferenceImpl#getDefaultValue <em>Default Value</em>}</li>
 *   <li>{@link hu.bme.mit.androtext.gui.androGuiLang.impl.ListPreferenceImpl#getEntries <em>Entries</em>}</li>
 *   <li>{@link hu.bme.mit.androtext.gui.androGuiLang.impl.ListPreferenceImpl#getEntryValues <em>Entry Values</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ListPreferenceImpl extends PreferenceImpl implements ListPreference
{
  /**
   * The cached value of the '{@link #getDialogTitle() <em>Dialog Title</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getDialogTitle()
   * @generated
   * @ordered
   */
  protected PreferenceDialogTitleAttribute dialogTitle;

  /**
   * The cached value of the '{@link #getDefaultValue() <em>Default Value</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getDefaultValue()
   * @generated
   * @ordered
   */
  protected PreferenceDefaultValueAttribute defaultValue;

  /**
   * The cached value of the '{@link #getEntries() <em>Entries</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getEntries()
   * @generated
   * @ordered
   */
  protected PreferenceEntriesAttribute entries;

  /**
   * The cached value of the '{@link #getEntryValues() <em>Entry Values</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getEntryValues()
   * @generated
   * @ordered
   */
  protected PreferenceEntryValuesAttribute entryValues;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected ListPreferenceImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return AndroGuiLangPackage.Literals.LIST_PREFERENCE;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public PreferenceDialogTitleAttribute getDialogTitle()
  {
    return dialogTitle;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetDialogTitle(PreferenceDialogTitleAttribute newDialogTitle, NotificationChain msgs)
  {
    PreferenceDialogTitleAttribute oldDialogTitle = dialogTitle;
    dialogTitle = newDialogTitle;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AndroGuiLangPackage.LIST_PREFERENCE__DIALOG_TITLE, oldDialogTitle, newDialogTitle);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setDialogTitle(PreferenceDialogTitleAttribute newDialogTitle)
  {
    if (newDialogTitle != dialogTitle)
    {
      NotificationChain msgs = null;
      if (dialogTitle != null)
        msgs = ((InternalEObject)dialogTitle).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AndroGuiLangPackage.LIST_PREFERENCE__DIALOG_TITLE, null, msgs);
      if (newDialogTitle != null)
        msgs = ((InternalEObject)newDialogTitle).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AndroGuiLangPackage.LIST_PREFERENCE__DIALOG_TITLE, null, msgs);
      msgs = basicSetDialogTitle(newDialogTitle, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, AndroGuiLangPackage.LIST_PREFERENCE__DIALOG_TITLE, newDialogTitle, newDialogTitle));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public PreferenceDefaultValueAttribute getDefaultValue()
  {
    return defaultValue;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetDefaultValue(PreferenceDefaultValueAttribute newDefaultValue, NotificationChain msgs)
  {
    PreferenceDefaultValueAttribute oldDefaultValue = defaultValue;
    defaultValue = newDefaultValue;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AndroGuiLangPackage.LIST_PREFERENCE__DEFAULT_VALUE, oldDefaultValue, newDefaultValue);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setDefaultValue(PreferenceDefaultValueAttribute newDefaultValue)
  {
    if (newDefaultValue != defaultValue)
    {
      NotificationChain msgs = null;
      if (defaultValue != null)
        msgs = ((InternalEObject)defaultValue).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AndroGuiLangPackage.LIST_PREFERENCE__DEFAULT_VALUE, null, msgs);
      if (newDefaultValue != null)
        msgs = ((InternalEObject)newDefaultValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AndroGuiLangPackage.LIST_PREFERENCE__DEFAULT_VALUE, null, msgs);
      msgs = basicSetDefaultValue(newDefaultValue, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, AndroGuiLangPackage.LIST_PREFERENCE__DEFAULT_VALUE, newDefaultValue, newDefaultValue));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public PreferenceEntriesAttribute getEntries()
  {
    return entries;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetEntries(PreferenceEntriesAttribute newEntries, NotificationChain msgs)
  {
    PreferenceEntriesAttribute oldEntries = entries;
    entries = newEntries;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AndroGuiLangPackage.LIST_PREFERENCE__ENTRIES, oldEntries, newEntries);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setEntries(PreferenceEntriesAttribute newEntries)
  {
    if (newEntries != entries)
    {
      NotificationChain msgs = null;
      if (entries != null)
        msgs = ((InternalEObject)entries).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AndroGuiLangPackage.LIST_PREFERENCE__ENTRIES, null, msgs);
      if (newEntries != null)
        msgs = ((InternalEObject)newEntries).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AndroGuiLangPackage.LIST_PREFERENCE__ENTRIES, null, msgs);
      msgs = basicSetEntries(newEntries, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, AndroGuiLangPackage.LIST_PREFERENCE__ENTRIES, newEntries, newEntries));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public PreferenceEntryValuesAttribute getEntryValues()
  {
    return entryValues;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetEntryValues(PreferenceEntryValuesAttribute newEntryValues, NotificationChain msgs)
  {
    PreferenceEntryValuesAttribute oldEntryValues = entryValues;
    entryValues = newEntryValues;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AndroGuiLangPackage.LIST_PREFERENCE__ENTRY_VALUES, oldEntryValues, newEntryValues);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setEntryValues(PreferenceEntryValuesAttribute newEntryValues)
  {
    if (newEntryValues != entryValues)
    {
      NotificationChain msgs = null;
      if (entryValues != null)
        msgs = ((InternalEObject)entryValues).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AndroGuiLangPackage.LIST_PREFERENCE__ENTRY_VALUES, null, msgs);
      if (newEntryValues != null)
        msgs = ((InternalEObject)newEntryValues).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AndroGuiLangPackage.LIST_PREFERENCE__ENTRY_VALUES, null, msgs);
      msgs = basicSetEntryValues(newEntryValues, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, AndroGuiLangPackage.LIST_PREFERENCE__ENTRY_VALUES, newEntryValues, newEntryValues));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case AndroGuiLangPackage.LIST_PREFERENCE__DIALOG_TITLE:
        return basicSetDialogTitle(null, msgs);
      case AndroGuiLangPackage.LIST_PREFERENCE__DEFAULT_VALUE:
        return basicSetDefaultValue(null, msgs);
      case AndroGuiLangPackage.LIST_PREFERENCE__ENTRIES:
        return basicSetEntries(null, msgs);
      case AndroGuiLangPackage.LIST_PREFERENCE__ENTRY_VALUES:
        return basicSetEntryValues(null, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case AndroGuiLangPackage.LIST_PREFERENCE__DIALOG_TITLE:
        return getDialogTitle();
      case AndroGuiLangPackage.LIST_PREFERENCE__DEFAULT_VALUE:
        return getDefaultValue();
      case AndroGuiLangPackage.LIST_PREFERENCE__ENTRIES:
        return getEntries();
      case AndroGuiLangPackage.LIST_PREFERENCE__ENTRY_VALUES:
        return getEntryValues();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case AndroGuiLangPackage.LIST_PREFERENCE__DIALOG_TITLE:
        setDialogTitle((PreferenceDialogTitleAttribute)newValue);
        return;
      case AndroGuiLangPackage.LIST_PREFERENCE__DEFAULT_VALUE:
        setDefaultValue((PreferenceDefaultValueAttribute)newValue);
        return;
      case AndroGuiLangPackage.LIST_PREFERENCE__ENTRIES:
        setEntries((PreferenceEntriesAttribute)newValue);
        return;
      case AndroGuiLangPackage.LIST_PREFERENCE__ENTRY_VALUES:
        setEntryValues((PreferenceEntryValuesAttribute)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case AndroGuiLangPackage.LIST_PREFERENCE__DIALOG_TITLE:
        setDialogTitle((PreferenceDialogTitleAttribute)null);
        return;
      case AndroGuiLangPackage.LIST_PREFERENCE__DEFAULT_VALUE:
        setDefaultValue((PreferenceDefaultValueAttribute)null);
        return;
      case AndroGuiLangPackage.LIST_PREFERENCE__ENTRIES:
        setEntries((PreferenceEntriesAttribute)null);
        return;
      case AndroGuiLangPackage.LIST_PREFERENCE__ENTRY_VALUES:
        setEntryValues((PreferenceEntryValuesAttribute)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case AndroGuiLangPackage.LIST_PREFERENCE__DIALOG_TITLE:
        return dialogTitle != null;
      case AndroGuiLangPackage.LIST_PREFERENCE__DEFAULT_VALUE:
        return defaultValue != null;
      case AndroGuiLangPackage.LIST_PREFERENCE__ENTRIES:
        return entries != null;
      case AndroGuiLangPackage.LIST_PREFERENCE__ENTRY_VALUES:
        return entryValues != null;
    }
    return super.eIsSet(featureID);
  }

} //ListPreferenceImpl
